﻿using HPIT.Logistics.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TakeoutMangesWeb
{
    public partial class ProductInfo : System.Web.UI.Page
    {
        public string pageaa { get; set; }
        public int PageLenth { get; set; }
        public int CurrentPage { get; set; }
        public int pagesize { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["name"] == null)
                {
                    Response.Redirect("AdminLogin.aspx");

                }
                GetRPT();
            }
        }

     

        public void GetRPT() {
            pagesize = 10;
            
            int page = Convert.ToInt32(Request.QueryString["page"]);
            if (page == 0)
            {
                page = 1;
            }
            int totalCount;
            Repeater1.DataSource = TakeoutMangesBLL.ProductBLL.GetProductInfo(page, pagesize, out totalCount, "");
            CurrentPage = totalCount;
       
        pageaa = MyAspNetPager.ShowPage(pagesize, page, totalCount);
            Repeater1.DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        { string name = TextBox1.Text.Trim();
            if (name != "")
            {
                Repeater1.DataSource = TakeoutMangesBLL.ProductBLL.getProduct(name);
                Repeater1.DataBind();
            }
            else {
                GetRPT();
            }
           
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            TextBox1.Text = "";
            GetRPT();
        }
    }
}